package com.dianpingmedia.common.utils;

import java.io.IOException;
import java.io.InputStream;

/**
 * protoc.exe -I=proto的输入目录 --java_out=java类输出目录 proto的输入目录包括包括proto文件
 * 
 * @author Administrator
 *
 */

public class GenerateClass {
	public static void main(String[] args) throws IOException {
		String protoFile = "initrequert.proto";
		String path = "E:/dpmedia/simulate/src/main/java/com/dianpingmedia/simulate/proto";
		String out = "E:/dpmedia/simulate/src/main/java/com/dianpingmedia/proto";
		String strCmd = "C:/Users/Administrator/Desktop/protoc-3.6.1-win32/bin/protoc.exe -I= "+path+
				" --java_out=" + out + " " + path + "/" + protoFile;
		System.out.println(strCmd);
		Process exec = Runtime.getRuntime().exec(strCmd);
		InputStream inputStream = exec.getErrorStream();
		byte[]  bytes=new byte[1024];
		int read = inputStream.read(bytes);

		System.out.println("完成:"+new String(bytes));
	}
}
